* The Politics of Minister Retention in Presidential Systems: 
* Technocrats, Partisans, and Government Approval 
*   Marcelo Camerlo & Anibal Perez-Linan
*   Comparative Politics, vol.47 , no.3 
*   Replication file, 30 Dec 2014

*DESCRIPTIVE STATISTICS
*STSET 
stset exit_port if portfolio>2 & bis_port<2 , origin(begin) failure (destxpt==2) id (idD)

*Profiles
tab adm if idspell==1 & portfolio>2,sum (TEC)
tab TEC if idspell==1 & portfolio>2
tab adm if idspell==1 & portfolio>2,sum (OUT)
tab OUT  if idspell==1 & portfolio>2
*approval 
tab adm  if portfolio==1,sum (approval)
sum approval if portfolio==1
*Minority
tab adm minority if portfolio==1 
*Coalition
tab adm coalition if portfolio==1
*UCR
tab adm ucr if portfolio==1
*Growth
sum (pib_var) if portfolio==1
tab adm   if portfolio==1, sum (pib_var)
*Inflation
sum (ipc_var) if portfolio==1
tab adm  if portfolio==1, sum (ipc_var)
*Neoliberalism
tab adm conver if portfolio==1
*Reelectibility
tab adm reelectibility if portfolio==1 & idspell==1
*Calendar
tab adm calendarend if portfolio==1 & idspell==1

*TABLE 1. Proportional Hazard Models of Minister Duration
*STSET 
stset exit_port if portfolio>2 & bis_port<2 , origin(begin) failure (destxpt==2) id (idD)

*MODEL I
stcox approval minority coal ucr  reelectibility calendarend  finance ipc_var pib_var  conver age_st woman  eco edu1 edu3 , level (95)

*MODEL II
stcox approval TEC OUT minority coal ucr  reelectibility calendarend  finance ipc_var pib_var  conver age_st woman, level (95)

*MODEL III
stcox approval TEC OUT T_appr O_appr minority coal ucr  reelectibility calendarend  finance ipc_var pib_var  conver age_st woman, level (95)

* Figure 2.1: approval, marginal effects for Technocrats
grinter approval, inter(T_appr) const02(TEC) clevel (95) yline(0) nom
/* check */ lincom approval+T_appr*1+O_appr*0

* Figure 2.2: approval, marginal effects for Outsiders
grinter approval, inter(O_appr) const02(OUT) clevel (95) yline(0) nom
/* check */ lincom approval+T_appr*0+O_appr*1

* Figure 3.1: Technocrats, marginal effects
grinter TEC, inter(T_appr) const02(approval) xline (31) clevel (95) yline(0) nom
/* check */ lincom TEC+T_appr*30, hr

* Figure 3.2: Outsiders, marginal effects
grinter OUT, inter(O_appr) const02(approval) xline (50) clevel (95) yline(0) nom
/* check */ lincom OUT+O_appr*80, hr


*MODEL IV (Control Function)
** First stage
reg   approval TEC OUT               minority coal ucr reelectibility calendarend finance ipc_var pib_var  conver age_st woman worldcup argwcup chn_grth honey
predict control_f, res 
label var control_f "control f(W Cup, China, Honeymoon)"
** Second stage
stcox approval TEC OUT T_appr O_appr minority coal ucr reelectibility calendarend finance ipc_var pib_var  conver age_st woman control_f, level (95)
/* check: technocrats */ lincom approval+T_appr*1+O_appr*0 , hr
/* check: outsiders */   lincom approval+T_appr*0+O_appr*1 , hr
drop control_f

* ROBUSTNESS TESTS FOR PORTFOLIOS
* Frailty  model
stcox approval TEC OUT T_appr O_appr minority coal ucr  reelectibility calendarend          ipc_var pib_var  conver age_st woman, level (95) shared (portfolio)

* Fixed portfolio effects
stcox approval TEC OUT T_appr O_appr minority coal ucr  reelectibility calendarend  finance ipc_var pib_var  conver age_st woman interior foreign defense chiefstaff, level (95)

